home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Full / Paragon Drive Backup 9 / DB90_SE_x64.msi / Data1.cab / _AFA7EBEC04834D96B89B9B1D4156C045 < prev    next >
Text File  |  2004-02-07  |  31KB  |  1,504 lines

  1. //    WebHelp 5.10.007
  2. var gaHSLoad=new Array();
  3. var gnMinIdx=0;
  4. var gnInsIdx=-1;
  5. var gsLoadingDivID="LoadingDiv";
  6. var gsLoadingMsg="Loading, click here to cancel...";
  7. var gaProj=null;
  8. var gaTocs=new Array();
  9. var goChunk=null;
  10. var gbReady=false;
  11. var gbToc=false;
  12. var gbXML=false;
  13. var gaRoot=new Array();
  14. var gnCC=-1;
  15. var gsTP="";
  16. var gaBTPs="";
  17. var gsCTPath="";
  18. var gnLT=-1;
  19. var gsPathSplit="\n";
  20. var gsBgColor="#ffffff";
  21. var gsBgImage="";
  22. var goFont=null;
  23. var goHFont=null;
  24.  
  25. var gsMargin="0pt";
  26. var gsIndent="15pt";
  27. var gsABgColor="#cccccc";
  28.  
  29. var giBookClose="";
  30. var giBookOpen="";
  31. var giBookItem="";
  32. var giURLItem="";
  33. var giNewBookClose="";
  34. var giNewBookOpen="";
  35. var giNewBookItem="";
  36. var giNewURLItem="";
  37. var gnImages=0;
  38. var gnLoadedImages=0;
  39. var gaImgs=new Array();
  40. var gbLoadData=false;
  41. var gobj=null;
  42. var gaTocsNs61Fix=null;
  43. var gbWhTHost=false;
  44. var gBookItems=new Array();
  45. var gInSync=false;
  46. var gbLData=false;
  47. var gbNeedFillStub=false;
  48. var gbLoadToc=false;
  49.  
  50. function chunkInfoQueue()
  51. {
  52.     this.aContent=new Array();
  53.     this.inQueue=function(cInfo)
  54.     {
  55.         this.aContent[this.aContent.length]=cInfo;
  56.     }
  57.     this.deQueue=function()
  58.     {
  59.         var cInfo=null;
  60.         if(this.aContent.length>0)
  61.         {
  62.             cInfo=this.aContent[0];
  63.             for(var i=1;i<this.aContent.length;i++)
  64.                 this.aContent[i-1]=this.aContent[i];
  65.             this.aContent.length--;
  66.         }
  67.         return cInfo;
  68.     }
  69.     this.length=function()
  70.     {
  71.         return this.aContent.length;
  72.     }
  73. }
  74.  
  75. var gchunkRequestQueue=new chunkInfoQueue();
  76.  
  77. function chunkInfo(nIdx, bLocal)
  78. {
  79.     this.nIdx=nIdx;
  80.     this.bLocal=bLocal;
  81. }
  82.  
  83. function setBackground(sBgImage)
  84. {
  85.     gsBgImage=sBgImage;
  86. }
  87.  
  88. function setBackgroundcolor(sBgColor)
  89. {
  90.     gsBgColor=sBgColor;
  91. }
  92.  
  93. function setFont(sType,sFontName,sFontSize,sFontColor,sFontStyle,sFontWeight,sFontDecoration)
  94. {
  95.     var vFont=new whFont(sFontName,sFontSize,sFontColor,sFontStyle,sFontWeight,sFontDecoration);
  96.     if(sType=="Normal") goFont=vFont;
  97.     else if(sType=="Hover") goHFont=vFont;
  98. }
  99.  
  100. function setActiveBgColor(sBgColor){gsABgColor=sBgColor;}
  101.  
  102. function setMargin(sMargin){gsMargin=sMargin;}
  103.  
  104. function setIndent(sIndent){gsIndent=sIndent;}
  105.  
  106. function setIcon(sType,sURL)
  107. {
  108.     if(sType=="BookOpen")
  109.         giBookOpen=sURL;
  110.     else if(sType=="BookClose")
  111.         giBookClose=sURL;
  112.     else if(sType=="Item")
  113.         giBookItem=sURL;
  114.     else if(sType=="RemoteItem")
  115.         giURLItem=sURL;
  116.     else if(sType=="NewBookClose")
  117.         giNewBookClose=sURL;
  118.     else if(sType=="NewBookOpen")
  119.         giNewBookOpen=sURL;
  120.     else if(sType=="NewItem")
  121.         giNewBookItem=sURL;
  122.     else if(sType=="NewRemoteItem")
  123.         giNewURLItem=sURL;        
  124. }
  125.  
  126. function bookItem(sTarget,sURL)
  127. {
  128.     if(sTarget)
  129.         this.sTarget=sTarget;
  130.     else
  131.         this.sTarget="bsscright";
  132.     this.sURL=sURL;
  133. }
  134.  
  135. function addBookItem(sBookId,sTarget,sURL)
  136. {
  137.     gBookItems[sBookId]=new bookItem(sTarget,sURL);        
  138. }
  139.  
  140. function tocChunk(sPPath,sDPath)
  141. {
  142.     this.sPPath=sPPath;
  143.     this.sDPath=sDPath;
  144.     this.nMI=-1;
  145.     this.aTocs=null;
  146. }
  147.  
  148. function addTocChunk(sPPath,sDPath)
  149. {
  150.     var oChunk=new tocChunk(sPPath,sDPath);
  151.     gaTocs[gaTocs.length]=oChunk;
  152.     return oChunk;
  153. }
  154.  
  155. function isHSLoad(nIdx)
  156. {
  157.     for(var i=0;i<gaHSLoad.length;i++)
  158.         if(gaHSLoad[i]==nIdx)
  159.             return true;
  160.     return false;
  161. }
  162.  
  163. function setHSLoad(nIdx)
  164. {
  165.     if(!isHSLoad(nIdx))
  166.     {
  167.         var len=gaHSLoad.length;
  168.         for(var i=0;i<len;i++)
  169.             if(gaHSLoad[i]==-1)
  170.             {
  171.                 gaHSLoad[i]=nIdx;
  172.                 return;
  173.             }
  174.         gaHSLoad[len]=nIdx;
  175.     }
  176. }
  177.  
  178. function setHSUnLoad(nIdx)
  179. {
  180.     if(isHSLoad(nIdx))
  181.     {
  182.         for(var i=0;i<gaHSLoad.length;i++)
  183.             if(gaHSLoad[i]==nIdx)
  184.             {
  185.                 gaHSLoad[i]=-1;
  186.                 return;
  187.             }
  188.     }
  189. }
  190.  
  191. function removeLoadingDiv()
  192. {
  193.     var eLoadingDiv=getElement(gsLoadingDivID);
  194.     if(eLoadingDiv)
  195.         removeThis(eLoadingDiv);
  196. }
  197.  
  198. function checkBookItem(nIdx)
  199. {
  200.     if(!gInSync)
  201.     {
  202.         var sBookId=getBookId(nIdx);
  203.         if(gBookItems[sBookId])
  204.         {
  205.             window.open(gBookItems[sBookId].sURL,gBookItems[sBookId].sTarget);
  206.         }
  207.     }
  208. }
  209.  
  210. function insertBookItems(nIdx,num)
  211. {
  212.     checkBookItem(nIdx);
  213.     var sChildBookId=getCBId(nIdx);
  214.     var eChildDiv=getElement(sChildBookId);
  215.     if(eChildDiv){
  216.         if((eChildDiv.childNodes&&eChildDiv.childNodes.length==0)||
  217.             (eChildDiv.all&&eChildDiv.all.length==0)){
  218.             var sHTML=writeBookItems(nIdx,num);
  219.             eChildDiv.innerHTML=sHTML;
  220.             setTimeout("syncInit()",1);
  221.         }
  222.     }
  223.     ExpandIt(nIdx);
  224. }
  225.  
  226. function isBookEmpty(nIdx)
  227. {
  228.     var num=getItemContentsNum(nIdx);
  229.     if (num>0)
  230.     {
  231.         var nCIdx=0;
  232.         do {
  233.             nCIdx++;
  234.             var i=nIdx+nCIdx;
  235.             var nItemType=getItemType(i);
  236.             if(nItemType==1){
  237.                 if (!isBookEmpty(i))
  238.                     return false;
  239.             }
  240.             else if(nItemType==4){
  241.                 var    sSrc=getRefURL(i);
  242.                 var nProj=getProject(sSrc);
  243.                 if(nProj!=-1){
  244.                     sSrc=gaRoot[nProj].sToc;
  245.                     if(sSrc)
  246.                         return false;
  247.                 }
  248.             }
  249.             else if(nItemType==2||nItemType==16||nItemType==8)
  250.                 return false;
  251.         } while(nCIdx<num);
  252.     }
  253.     return true;
  254. }
  255.  
  256. function writeBook(nIdx)
  257. {
  258.     var sIcon=getBookImage(nIdx,true);
  259.     var sName=_textToHtml(getItemName(nIdx));
  260.     sIcon=_textToHtml_nonbsp(sIcon);
  261.     
  262.     var nType=getItemType(nIdx);
  263.     var bLocal=(nType==1);
  264.     var bLocalProject=(nType!=4);
  265.     
  266.     var sHTML="<div id=\""+getPBId(nIdx)+"\" class=";
  267.     if(bLocal)
  268.     {
  269.         if (!isBookEmpty(nIdx))
  270.         {
  271.             sHTML+="parent><p><nobr><a id=\""+getBookId(nIdx)+"\" href=\"javascript:void(0);\" onfocus=\"markBook("+nIdx+");\" onclick=\"";
  272.             sHTML+="insertBookItems("+nIdx+", "+getItemContentsNum(nIdx);
  273.             sHTML+=");return false;\" title=\""+sName+"\"><img alt=\"Book\" name=\""+getBId(nIdx)+"\" src=\""+sIcon+"\" border=0 align=\"absmiddle\">";
  274.             sHTML+=" "+sName+"</a></nobr></p></div>";
  275.             var sURL=_textToHtml_nonbsp(getItemURL(nIdx));
  276.             if(sURL!="")
  277.                 addBookItem(getBookId(nIdx),_textToHtml_nonbsp(getTopicTarget(nIdx)),sURL);
  278.             sHTML+="<div id=\""+getCBId(nIdx)+"\" class=child></div>";
  279.         }
  280.         else
  281.             sHTML="";
  282.     }
  283.     else
  284.     {
  285.         sHTML+="stub></div>";
  286.         gbNeedFillStub=true;
  287.         setTimeout("fillStub("+nIdx+","+bLocalProject+");",100);
  288.     }
  289.     return sHTML;
  290. }
  291.  
  292. function checkFillStub()
  293. {
  294.     if(!gbLData)
  295.     {
  296.         if(gchunkRequestQueue.length()>0)
  297.         {
  298.             var cInfo=gchunkRequestQueue.deQueue();
  299.             if(cInfo)
  300.             {
  301.                 fillStub(cInfo.nIdx,cInfo.bLocal);
  302.                 return;
  303.             }
  304.         }
  305.     }
  306.     if(gbNeedFillStub)
  307.     {
  308.         gbNeedFillStub=false;
  309.         setTimeout("syncInit()",1);
  310.     }
  311. }
  312.  
  313. function fillStub(nIdx,bLocalProject)
  314. {
  315.     if(!gbLData)
  316.     {
  317.         gbLData=true;
  318.         var sObj=getElement(getPBId(nIdx));
  319.         if(sObj!=null)
  320.         {
  321.             tocExpandHelpSet(nIdx,bLocalProject);
  322.             gbNeedFillStub=false;
  323.             setTimeout("syncInit()",1);
  324.         }
  325.         else
  326.             setTimeout("fillStub("+nIdx+","+bLocalProject+");",100);
  327.     }
  328.     else
  329.         gchunkRequestQueue.inQueue(new chunkInfo(nIdx,bLocalProject));
  330. }
  331.  
  332. function getBookId(nIdx){return "B_"+nIdx;}
  333.  
  334. function getItemId(nIdx){return "I_"+nIdx;}
  335.  
  336. function markBook(nIdx)
  337. {
  338.     var obj=getElement(getItemId(nIdx));
  339.     if(obj==null)
  340.         obj=getElement(getBookId(nIdx));
  341.     if(gbNav6)
  342.     {
  343.         gobj=obj;
  344.         setTimeout("delayMarkObj();",1);
  345.     }
  346.     else
  347.         markObj(obj);
  348. }
  349.  
  350. function delayMarkObj()
  351. {
  352.     if(gobj)
  353.     {
  354.         markObj(gobj);
  355.         gobj=null;
  356.     }
  357. }
  358.  
  359. function markObj(obj)
  360. {
  361.     if(obj!=null)
  362.     {
  363.         HighLightElement(obj,gsABgColor,"transparent");
  364.         var sPath=calTocPath(obj);
  365.         if(gsCTPath!=sPath)
  366.             gsCTPath=sPath;
  367.     }
  368. }
  369.  
  370. function markItem(nIdx)
  371. {
  372.     var obj=getElement(getItemId(nIdx));
  373.     if(gbNav6)
  374.     {
  375.         gobj=obj;
  376.         setTimeout("delayMarkObj();",1);
  377.     }
  378.     else
  379.         markObj(getElement(getItemId(nIdx)));
  380. }
  381.  
  382. function calTocPath(obj)
  383. {
  384.     var sPath=getInnerText2(obj);
  385.     var pObj=getParentNode(obj);
  386.     do
  387.     {
  388.         while(pObj!=null&&!isCBId(pObj.id)) pObj=getParentNode(pObj);
  389.         if(pObj!=null)
  390.         {
  391.             var nId=getIdByCBId(pObj.id);
  392.             var sObj=getElement(getPBId(nId));
  393.             if(sObj!=null)
  394.             {
  395.                 var objs=getItemsByBook(sObj);
  396.                 for(var i=0;i<objs.length;i++)
  397.                 {
  398.                     var sText=getInnerText2(objs[i]);
  399.                     if(sText.length!=0)
  400.                     {
  401.                         sPath=sText+gsPathSplit+sPath;
  402.                         break;
  403.                     }
  404.                 }
  405.             }
  406.             pObj=getParentNode(pObj);
  407.         }
  408.     }while(pObj!=null);
  409.     return sPath;
  410. }
  411.  
  412. function writeAnItem(nIdx)
  413. {
  414.     var sTarget=_textToHtml_nonbsp(getTopicTarget(nIdx));
  415.     var sIcon=getItemIcon(nIdx,0);
  416.     if(sIcon=="")
  417.     {
  418.         var nItemType=getItemType(nIdx);
  419.         if(nItemType&2)
  420.             sIcon=getItemImage(nIdx,false);
  421.         else
  422.             sIcon=getItemImage(nIdx,true);
  423.     }
  424.     sIcon=_textToHtml_nonbsp(sIcon);
  425.     var sName=_textToHtml(getItemName(nIdx));
  426.     var sHTML="<p><nobr><a id=\""+getItemId(nIdx)+"\" onfocus=\"markItem("+nIdx+");\""
  427.     var sAltString="";
  428.     if(nItemType&2)
  429.         sAltString="Page";
  430.     else
  431.         sAltString="Remote Page";
  432.     if(sTarget!="")
  433.         sHTML+="target=\""+sTarget+"\" ";
  434.     sHTML+="href=\""+_textToHtml_nonbsp(getItemURL(nIdx))+"\" title=\""+sName+"\"><img alt=\""+sAltString+"\" src=\""+sIcon+"\" border=0 align=\"absmiddle\"> "+sName+"</a></nobr></p>";
  435.     return sHTML;
  436. }
  437.  
  438. function writeBookItems(nIdx,num)
  439. {
  440.     var sHTML="";
  441.     if(num>0){
  442.         var nCIdx=0;
  443.         do{
  444.             nCIdx++;
  445.             var i=nIdx+nCIdx;
  446.             var nItemType=getItemType(i);
  447.             if(nItemType==1||nItemType==4||nItemType==8){
  448.                 sHTML+=writeBook(i);    
  449.                 nCIdx+=getItemContentsNum(i);        
  450.             }
  451.             else if(nItemType==2||nItemType==16){
  452.                 sHTML+=writeAnItem(i);
  453.             }
  454.         }
  455.         while(nCIdx<num);
  456.     }
  457.     return sHTML;
  458. }
  459.  
  460. function tocExpandHelpSet(nIdx,bLocal)
  461. {
  462.     checkBookItem(nIdx);
  463.     removeLoadingDiv();
  464.     if(!isHSLoad(nIdx))
  465.     {
  466.         setHSLoad(nIdx);
  467.         var sSrc="";
  468.         if(bLocal){
  469.             var oChunk=getChunk(nIdx);
  470.             if(oChunk)
  471.             {
  472.                 goChunk=addTocChunk(oChunk.sPPath,oChunk.sDPath);
  473.                 sSrc=oChunk.aTocs[nIdx-oChunk.nMI].sRefURL;
  474.             }
  475.         }
  476.         else{
  477.             sSrc=getRefURL(nIdx);
  478.             var nProj=getProject(sSrc);
  479.             if(nProj!=-1)
  480.             {
  481.                 sSrc=gaRoot[nProj].sToc;
  482.                 if(sSrc)
  483.                     goChunk=addTocChunk(gaProj[nProj].sPPath,gaProj[nProj].sDPath);
  484.                 else
  485.                     goChunk=null;
  486.             }
  487.             else
  488.                 goChunk=null;
  489.         }
  490.         if(goChunk)
  491.         {
  492.             PrepareLoading(nIdx);
  493.             gbToc=false;
  494.             loadData2(goChunk.sPPath+goChunk.sDPath+sSrc);
  495.         }
  496.         else
  497.         {
  498.             gbLData=false;
  499.             checkFillStub();
  500.         }
  501.     }
  502. }
  503.  
  504. function getProject(sSrc)
  505. {
  506.     for(var i=0;i<gaProj.length;i++)
  507.         if(isSamePath(getPath(sSrc),gaProj[i].sPPath))
  508.             return i;
  509.     return -1;
  510. }
  511.  
  512. function getPath(sPath)
  513. {
  514.     if(sPath!="")
  515.     {
  516.         sPath=_replaceSlash(sPath);
  517.         var nPosFile=sPath.lastIndexOf("/");
  518.         sPath=sPath.substring(0,nPosFile+1);
  519.     }
  520.     return sPath;
  521. }
  522.  
  523. function isSamePath(sPath1,sPath2)
  524. {
  525.     return (sPath1.toLowerCase()==sPath2.toLowerCase());
  526. }
  527.  
  528. function PrepareLoading(nIdx)
  529. {
  530.     gnInsIdx=nIdx;
  531.     if(!gsTP)
  532.     {
  533.         var oObj=getElement(getPBId(gnInsIdx));
  534.         if(oObj)
  535.             oObj.insertAdjacentHTML("afterEnd",writeLoadingDiv(nIdx));
  536.     }
  537. }
  538.  
  539. function writeLoadingDiv(nIdx)
  540. {
  541.     return"<div id=\""+gsLoadingDivID+"\" class=parent onclick=\"removeLoadingDiv();\" style=\"padding-left:4px;background-color:ivory;border-width:1;border-style:solid;border-color:black;width:150px;\">"+gsLoadingMsg+"</div>";
  542. }
  543.  
  544. function getItemName(nIdx)
  545. {
  546.     var oChunk=getChunk(nIdx);
  547.     if(oChunk)
  548.         return oChunk.aTocs[nIdx-oChunk.nMI].sItemName;
  549.     else
  550.         return null;
  551. }
  552.  
  553. function getItemContentsNum(nIdx)
  554. {
  555.     var oChunk=getChunk(nIdx);
  556.     if(oChunk)
  557.         return oChunk.aTocs[nIdx-oChunk.nMI].nContents;
  558.     else
  559.         return null;
  560. }
  561.  
  562. function getItemType(nIdx)
  563. {
  564.     var oChunk=getChunk(nIdx);
  565.     if(oChunk)
  566.         return oChunk.aTocs[nIdx-oChunk.nMI].nType;
  567.     else
  568.         return 0;
  569. }
  570.  
  571. function getItemURL(nIdx)
  572. {
  573.     var oChunk=getChunk(nIdx);
  574.     if(oChunk)
  575.     {
  576.         var sPath=oChunk.aTocs[nIdx-oChunk.nMI].sItemURL;
  577.         if(!(sPath==null||sPath==""))
  578.         {
  579.             return _getFullPath(oChunk.sPPath,sPath);
  580.         }
  581.     }
  582.     return "";
  583. }
  584.  
  585. function getRefURL(nIdx)
  586. {
  587.     var oChunk=getChunk(nIdx);
  588.     if(oChunk)
  589.     {
  590.         var sPath=oChunk.aTocs[nIdx-oChunk.nMI].sRefURL;
  591.         if(!(sPath==null||sPath==""))
  592.         {
  593.             return _getFullPath(oChunk.sPPath,sPath)
  594.         }
  595.     }
  596.     return "";
  597. }
  598.  
  599. function getTopicTarget(nIdx)
  600. {
  601.     var oChunk=getChunk(nIdx);
  602.     if(oChunk)
  603.     {
  604.         if(typeof(oChunk.aTocs[nIdx-oChunk.nMI].sTarget)!="undefined")
  605.             return oChunk.aTocs[nIdx-oChunk.nMI].sTarget;
  606.     }
  607.     return "";
  608. }
  609.  
  610. function getItemIcon(nIdx,nIconIdx)
  611. {
  612.     var oChunk=getChunk(nIdx);
  613.     if(oChunk)
  614.     {
  615.         if(typeof(oChunk.aTocs[nIdx-oChunk.nMI].sIconRef)!="undefined")
  616.         {
  617.             var sIconRef=oChunk.aTocs[nIdx-oChunk.nMI].sIconRef;
  618.             var nIndex=sIconRef.indexOf(";");
  619.             while(nIconIdx-->0&&nIndex!=-1)
  620.             {
  621.                 sIconRef=sIconRef.substring(nIndex+1);
  622.                 nIndex=sIconRef.indexOf(";");
  623.             }
  624.             if(nIconIdx<0)
  625.             {
  626.                 if(nIndex!=-1)
  627.                     sIconRef=sIconRef.substring(0,nIndex);
  628.                 return _getFullPath(oChunk.sPPath,sIconRef)
  629.             }
  630.         }
  631.     }
  632.     return "";
  633. }
  634.  
  635. function TocWriteClassStyle()
  636. {
  637.     var sStyle="<STYLE TYPE='text/css'>\n";
  638.     if(gsBgImage)
  639.         sStyle+="body {border-top:"+gsBgColor+" 1px solid;}\n";
  640.     else
  641.         sStyle+="body {border-top:black 1px solid;}\n";
  642.     sStyle+="P {"+getFontStyle(goFont)+"margin-top:"+gsMargin+";margin-bottom:"+gsMargin+";}\n";
  643.     sStyle+="DIV {margin-top:"+gsMargin+";margin-bottom:"+gsMargin+";}\n";
  644.     sStyle+=".parent {margin-left:0pt;}\n";
  645.     sStyle+=".stub {margin-left:0pt;display:none}\n";
  646.     sStyle+=".child {display:none;margin-left:"+gsIndent+";}\n";
  647.     sStyle+="A:link {"+getFontStyle(goFont)+"}\n";
  648.     sStyle+="A:visited {"+getFontStyle(goFont)+"}\n";
  649.     sStyle+="A:active {background-color:"+gsABgColor+";}\n";
  650.     sStyle +="A:hover {"+getFontStyle(goHFont)+"}\n";
  651.     sStyle+="</STYLE>";
  652.     document.write(sStyle);
  653. }
  654.  
  655. function TocWriteFixedWidth(bBegin,nWidth)
  656. {
  657.     if((gbIE4)&&(gbMac)&&(!gbIE5)){
  658.         if(bBegin)
  659.             document.write("<table width="+nWidth+" border=0><tr><td>");
  660.         else
  661.             document.write("</td></tr></table>");
  662.     }
  663. }
  664.  
  665. function TocInitPage()
  666. {
  667.     var tempColl=getItemsByBook(document.body);
  668.     if(tempColl.length>0)
  669.         tempColl[0].focus();
  670. }
  671.  
  672. function getItemsFromObj(obj)
  673. {
  674.     var aAnchor=new Array();
  675.     var tempColl=getChildrenByTag(obj,"P");
  676.     if(tempColl&&tempColl.length>0)
  677.     {
  678.         var anobr=new Array();
  679.         for(var i=0;i<tempColl.length;i++)
  680.         {
  681.             var tempNobr=getChildrenByTag(tempColl[i],"NOBR");
  682.             if(tempNobr&&tempNobr.length>0)
  683.                 for(var j=0;j<tempNobr.length;j++)
  684.                     anobr[anobr.length]=tempNobr[j];
  685.         }
  686.         for(var s=0;s<anobr.length;s++)
  687.         {
  688.             var tempAnchor=getChildrenByTag(anobr[s],"A");
  689.             if(tempAnchor&&tempAnchor.length>0)
  690.                 for(var u=0;u<tempAnchor.length;u++)
  691.                     aAnchor[aAnchor.length]=tempAnchor[u];
  692.         }
  693.     }
  694.     return aAnchor;
  695. }
  696.  
  697. function getItemsByBook(obj)
  698. {
  699.     var aAnchor=new Array();
  700.     var aTAnchor=getItemsFromObj(obj);
  701.     for(var i=0;i<aTAnchor.length;i++)
  702.         aAnchor[aAnchor.length]=aTAnchor[i];
  703.     var tempBook=getChildrenByTag(obj,"DIV");
  704.     if(tempBook&&tempBook.length>0)
  705.         for(var j=0;j<tempBook.length;j++)
  706.         {
  707.             var aTAnchorDiv=getItemsFromObj(tempBook[j]);
  708.             for(var s=0;s<aTAnchorDiv.length;s++)
  709.                 aAnchor[aAnchor.length]=aTAnchorDiv[s];
  710.         }
  711.     return aAnchor;
  712. }
  713.  
  714. function ExpandIt(nId)
  715. {
  716.     if(!gsTP)
  717.         ExpandIt2(nId,false);
  718. }
  719.  
  720. function ExpandIt2(nId,bForceOpen)
  721. {
  722.     var oC=TocExpand(nId,true,bForceOpen);
  723.     var nNewScroll=document.body.scrollTop;
  724.     if(oC.style.display=="block"){
  725.         var nTop=oC.offsetTop;
  726.         var nBottom=nTop+oC.offsetHeight;
  727.         if(document.body.scrollTop+document.body.clientHeight<nBottom){
  728.             nNewScroll=nBottom-document.body.clientHeight;
  729.         }
  730.         if(nBottom-nTop>document.body.clientHeight){
  731.             nNewScroll=nTop-20;
  732.         }
  733.     }
  734.     document.body.scrollTop=nNewScroll;
  735. }
  736.  
  737. function TocExpand(nId,bChangeImg,bForceOpen)
  738. {
  739.     var oDiv=getElement(getCBId(nId));
  740.     if(oDiv==null) return null;
  741.  
  742.     var whichIm=document.images[getBId(nId)];
  743.     if((oDiv.style.display!="block")||bForceOpen){
  744.         oDiv.style.display="block";
  745.         if(bChangeImg){
  746.             var sPath=getPath(whichIm.src);
  747.             sPath=_getFullPath(sPath,getBookImage(nId,false));
  748.             whichIm.src=sPath;        
  749.         }
  750.     }else{
  751.         oDiv.style.display="none";
  752.         if(bChangeImg){
  753.             var sPath=getPath(whichIm.src);
  754.             sPath=_getFullPath(sPath,getBookImage(nId,true));
  755.             whichIm.src=sPath;
  756.         }
  757.         if(gbMac&&gbIE5){
  758.             this.parent.document.getElementById("tocIFrame").style.width="101%";
  759.             this.parent.document.getElementById("tocIFrame").style.width="100%";
  760.         }
  761.     }
  762.     return oDiv;
  763. }
  764.  
  765. function getChunkId(n)
  766. {
  767.     var nCan=-1;
  768.     for(var i=0;i<gaTocs.length;i++)
  769.         if(gaTocs[i].nMI<=n&&gaTocs[i].nMI!=-1)
  770.         {
  771.             if(nCan==-1)
  772.                 nCan=i;
  773.             else
  774.                 if(gaTocs[i].nMI>=gaTocs[nCan].nMI)
  775.                     nCan=i;
  776.         }
  777.     if(nCan!=-1)
  778.         return nCan;
  779.     else
  780.         return -1;
  781. }
  782.  
  783. function getChunk(n)
  784. {
  785.     if(gnCC!=-1&&gaTocs[gnCC].nMI<=n&&(gnCC==gaTocs.length-1||
  786.         gaTocs[gnCC+1].nMI>n))
  787.     {    
  788.         return gaTocs[gnCC];
  789.     }
  790.     else{
  791.         gnCC=getChunkId(n);
  792.         if(gnCC!=-1)
  793.             return gaTocs[gnCC];
  794.         else
  795.             return null;
  796.     }
  797. }
  798.  
  799. function getBookImage(nIdx,bClosed)
  800. {
  801.     var nIdx=bClosed?0:1;
  802.     var sIcon=getItemIcon(nIdx,nIdx);
  803.     if(sIcon=="")
  804.         if(bClosed)
  805.             sIcon=giBookClose;
  806.         else
  807.             sIcon=giBookOpen;
  808.     return _getFullPath(gaProj[0].sPPath,sIcon);
  809. }
  810.  
  811. function getItemImage(nIdx,bRemote)
  812. {
  813.     var sIcon=getItemIcon(nIdx,0);
  814.     if(sIcon=="")
  815.         if(bRemote)
  816.             sIcon=giURLItem;
  817.         else
  818.             sIcon=giBookItem;
  819.     return _getFullPath(gaProj[0].sPPath,sIcon);
  820. }
  821.  
  822. function getInnerText2(obj)
  823. {
  824.     var sText=getInnerText(obj);
  825.     if(sText.length>0&&!gbOpera7)
  826.         sText=sText.substring(1);
  827.     return sText;
  828. }
  829.  
  830. function expandToc(oObj,sRest,aIdList)
  831. {
  832.     var len=aIdList.length;
  833.     var nPos=sRest.indexOf(gsPathSplit);
  834.     if(nPos!=-1)
  835.     {
  836.         sPart=sRest.substring(0,nPos);
  837.         sRest=sRest.substring(nPos+1);
  838.     }
  839.     else
  840.     {
  841.         sPart=sRest;
  842.         var aTagAs=getItemsByBook(oObj);
  843.         for(var s=0;s<aTagAs.length;s++)
  844.         {
  845.             var sText=getInnerText2(aTagAs[s]);
  846.             if(sText==sPart)
  847.             {
  848.                 aIdList[len]=aTagAs[s];
  849.                 return 1;
  850.             }
  851.         }
  852.         return 0;
  853.     }
  854.         
  855.     var aChildren=getChildrenByTag(oObj,"DIV");
  856.     for(var i=0;i<aChildren.length;i++)
  857.     {
  858.         var sPId=aChildren[i].id;
  859.         if(!isPBId(sPId))
  860.             continue;
  861.         var sText=getInnerText2(aChildren[i]);
  862.         if(sText!=sPart)
  863.             continue;
  864.         aIdList[len]=getIdByPBId(sPId);
  865.         var sCId=getCBId(aIdList[len]);
  866.         var oCObj=getElement(sCId);
  867.         if(oCObj)
  868.         {
  869.             if(oCObj.innerHTML=="")
  870.             {
  871.                 var obj=getItemsByBook(aChildren[i]);
  872.                 if(obj.length>0)
  873.                 {
  874.                     if(gbNav6)
  875.                     {
  876.                         var sCommand=obj[0].getAttribute("onClick");
  877.                         var nCommand=sCommand.indexOf(";");
  878.                         sCommand=sCommand.substring(0,nCommand);
  879.                         setTimeout(sCommand,1);
  880.                     }
  881.                     else
  882.                         obj[0].click();
  883.                 }
  884.                 return -1;
  885.             }
  886.             var nRet=expandToc(oCObj,sRest,aIdList);
  887.             if(nRet)
  888.                 return nRet;
  889.         }
  890.     }
  891.     aIdList.length=len;
  892.     return 0;
  893. }
  894.  
  895. function getIdByPBId(sPId)
  896. {
  897.     return parseInt(sPId.substring(2,sPId.length-1));
  898. }
  899.  
  900. function getIdByCBId(sCId)
  901. {
  902.     return parseInt(sCId.substring(2,sCId.length-1));
  903. }
  904.  
  905. function isPBId(sId)
  906. {
  907.     return (sId&&sId.indexOf("B_")==0&&sId.lastIndexOf("P")==sId.length-1);
  908. }
  909.  
  910. function isCBId(sId)
  911. {
  912.     return (sId&&sId.indexOf("B_")==0&&sId.lastIndexOf("C")==sId.length-1);
  913. }
  914.  
  915. function getBId(nIdx)
  916. {
  917.     return "B_"+nIdx;
  918. }
  919.  
  920. function getPBId(nIdx)
  921. {
  922.     return getBId(nIdx)+"P";
  923. }
  924.  
  925. function getCBId(nIdx)
  926. {
  927.     return getBId(nIdx)+"C";
  928. }
  929.  
  930. function getClosestTocPath(aPaths)
  931. {
  932.     var nMaxSimilarity=0;
  933.     var nThatIndex=-1;
  934.     var sPath=null;
  935.     if(aPaths.length==0) return sPath;
  936.     for(var i=0;i<aPaths.length;i++)
  937.     {
  938.         var nSimilarity=comparePath(gsCTPath,aPaths[i]);
  939.         if(nSimilarity>nMaxSimilarity)
  940.         {
  941.             nMaxSimilarity=nSimilarity;
  942.             nThatIndex=i;
  943.         }
  944.     }
  945.     if(nThatIndex!=-1)
  946.         sPath=aPaths[nThatIndex];
  947.     else
  948.         sPath=aPaths[0];
  949.     return sPath;
  950. }
  951.  
  952. function comparePath(sPath1,sPath2)
  953. {
  954.     var nMaxSimilarity=0;
  955.     var nStartPos1=0;
  956.     var nPos1=-1;
  957.     var nStartPos2=0;
  958.     var nPos2=-1;
  959.     do{
  960.         var sCheck1=null;
  961.         var sCheck2=null;
  962.         nPos1=sPath1.indexOf(gsPathSplit,nStartPos1);
  963.         if(nPos1!=-1)
  964.         {
  965.             sCheck1=sPath1.substring(nStartPos1,nPos1);
  966.             nStartPos1=nPos1+1;
  967.         }
  968.         else
  969.         {
  970.             sCheck1=sPath1.substring(nStartPos1);
  971.             nStartPos1=-1;
  972.         }
  973.         nPos2=sPath2.indexOf(gsPathSplit,nStartPos2);
  974.         if(nPos1!=-1)
  975.         {
  976.             sCheck2=sPath2.substring(nStartPos2,nPos2);
  977.             nStartPos2=nPos2+1;
  978.         }
  979.         else
  980.         {
  981.             sCheck2=sPath2.substring(nStartPos2);
  982.             nStartPos2=-1;
  983.         }
  984.         if(sCheck1==sCheck2)
  985.             nMaxSimilarity++;
  986.         else
  987.             break;
  988.     }while(nStartPos1!=-1&&nStartPos2!=-1);
  989.     return nMaxSimilarity;
  990. }
  991.  
  992. function getTocPaths(oTopicParam)
  993. {
  994.     var aRelTocPaths=oTopicParam.aPaths;
  995.     var aPaths=new Array();
  996.     for(var i=0;i<gaProj.length;i++)
  997.         if(isSamePath(gaProj[i].sPPath,oTopicParam.sPPath))
  998.         {
  999.             for(var j=0;j<aRelTocPaths.length;j++)
  1000.                 for (var k=0;k<gaRoot[i].aRPath.length;k++)
  1001.                 {
  1002.                     var sPath=gaRoot[i].aRPath[k]+aRelTocPaths[j];
  1003.                     aPaths[aPaths.length]=sPath.substring(1);
  1004.                 }
  1005.             break;
  1006.         }
  1007.     return aPaths;
  1008. }
  1009.  
  1010. function syncInit()
  1011. {
  1012.     if(gsTP&&!gbNeedFillStub)
  1013.     {
  1014.         gInSync=true;
  1015.         var obj=document.body;
  1016.         var aIdList=new Array();
  1017.         var nRet=expandToc(obj,gsTP,aIdList);
  1018.         if(nRet!=-1)
  1019.         {
  1020.             if(nRet==1)
  1021.             {
  1022.                 if(aIdList.length)
  1023.                     for(var i=0;i<aIdList.length-1;i++)
  1024.                         ExpandIt2(aIdList[i],true);
  1025.                 gsCTPath=gsTP;
  1026.                 if(!gbIE55)
  1027.                     aIdList[aIdList.length-1].focus();
  1028.                 else
  1029.                     HighLightElement(aIdList[aIdList.length-1],gsABgColor,"transparent");
  1030.             }
  1031.             var aPaths=gaBTPs;
  1032.             gsTP=null;
  1033.             gaBTPs=null;
  1034.             if(aPaths!=null)
  1035.             {
  1036.                 var sPath=getClosestTocPath(aPaths);
  1037.                 if(sPath!=null)
  1038.                 {    
  1039.                     gsTP=sPath;        
  1040.                     setTimeout("syncInit()",1);
  1041.                 }
  1042.             }
  1043.         }
  1044.         gInSync=false;
  1045.     }
  1046. }
  1047.  
  1048. function loadToc()
  1049. {
  1050.     if(!gbLoadToc)
  1051.     {
  1052.         var oResMsg=new whMessage(WH_MSG_GETPROJINFO,this,1,null);
  1053.         if(SendMessage(oResMsg)&&oResMsg.oParam)
  1054.         {
  1055.             gbLoadToc=true;
  1056.             var oProj=oResMsg.oParam;
  1057.             gaProj=oProj.aProj;
  1058.             gbXML=oProj.bXML;
  1059.             load1B1();
  1060.         }
  1061.     }
  1062. }
  1063.  
  1064. function load1B1()
  1065. {
  1066.     if(gnLT+1<gaProj.length)
  1067.         for(var i=gnLT+1;i<gaProj.length;i++)
  1068.             if(gaProj[i].sToc)
  1069.             {
  1070.                 gbToc=true;
  1071.                 gnLT=i;
  1072.                 setTimeout("loadTocInfo()",1);
  1073.                 return true;
  1074.             }
  1075.     return false;
  1076. }
  1077.  
  1078. function loadTocInfo()
  1079. {
  1080.     loadData2(gaProj[gnLT].sPPath+gaProj[gnLT].sDPath+gaProj[gnLT].sToc);
  1081. }
  1082.  
  1083. function loadData2(sFile)
  1084. {
  1085.     if(gbXML)
  1086.         loadDataXML(sFile);
  1087.     else
  1088.         loadData(sFile);
  1089. }
  1090.  
  1091. function projReady(sRoot,aProj)
  1092. {
  1093.     if(gaRoot.length<=gnLT||!gaRoot[gnLT])
  1094.         gaRoot[gnLT]=new Object();
  1095.     gaRoot[gnLT].sToc=sRoot;
  1096.     
  1097.     if(gnLT==0)
  1098.     {
  1099.         gaRoot[gnLT].aRPath=new Array();
  1100.         gaRoot[gnLT].aRPath[0]=gsPathSplit;
  1101.     }
  1102.  
  1103.     updatePTPath(gnLT,aProj);
  1104.  
  1105.     if(!((gnLT+1<gaProj.length)&&load1B1()))
  1106.     {
  1107.         gbReady=true;
  1108.         if(gbIE4)
  1109.             setTimeout("loadImages();",1);
  1110.         else
  1111.             setTimeout("loadTData();",1);
  1112.     }
  1113. }
  1114.  
  1115. function loadTData()
  1116. {
  1117.     if(gaProj[0].sToc!="")
  1118.     {
  1119.         gbLData=true;
  1120.         goChunk=addTocChunk(gaProj[0].sPPath,gaProj[0].sDPath);
  1121.         gbToc=false;
  1122.         loadData2(gaProj[0].sPPath+gaProj[0].sDPath+gaRoot[0].sToc);
  1123.     }
  1124. }
  1125.  
  1126. function updatePTPath(n,aProj)
  1127. {
  1128.     if(aProj)
  1129.         for(var i=0;i<aProj.length;i++)
  1130.         {
  1131.             var sFullPath=_getFullPath(gaProj[n].sPPath,aProj[i].sPPath);
  1132.             for(var j=0;j<gaProj.length;j++)
  1133.                 if(isSamePath(sFullPath,gaProj[j].sPPath))
  1134.                 {
  1135.                     if(gaRoot.length<=j||!gaRoot[j])
  1136.                         gaRoot[j]=new Object();
  1137.                     if(!gaRoot[j].aRPath)
  1138.                         gaRoot[j].aRPath=new Array();
  1139.  
  1140.                     if(gaRoot[n].aRPath)
  1141.                         for(var k=0;k<gaRoot[n].aRPath.length;k++)
  1142.                         {
  1143.                             var bDup=false;
  1144.                             var sTFPath=gaRoot[n].aRPath[k]+aProj[i].sRPath;
  1145.                             for(var l=0;l<gaRoot[j].aRPath.length;l++)
  1146.                                 if(gaRoot[j].aRPath[l]==sTFPath)
  1147.                                 {
  1148.                                     bDup=true;
  1149.                                     break;
  1150.                                 }
  1151.                             if(!bDup)
  1152.                                 gaRoot[j].aRPath[gaRoot[j].aRPath.length]=sTFPath;
  1153.                         }
  1154.                     else
  1155.                         gaRoot[j].aRPath[gaRoot[j].aRPath.length]=aProj[i].sRPath;
  1156.                     break;
  1157.                 }
  1158.         }
  1159. }
  1160.  
  1161. function onLoadXMLError()
  1162. {
  1163.     if(gbToc)
  1164.     {
  1165.         var sRoot="";
  1166.         var aRProj=new Array();
  1167.         projReady(sRoot,aRProj);
  1168.     }
  1169.     else
  1170.     {
  1171.         var aToc=new Array();
  1172.         putData(aToc)
  1173.     }
  1174. }
  1175.  
  1176. function putDataXML(xmlDoc,sDocPath)
  1177. {
  1178.     if(gbToc)
  1179.     {
  1180.         var tocNode=xmlDoc.getElementsByTagName("toc")[0];
  1181.         if(tocNode)
  1182.         {
  1183.             var sRoot=tocNode.getAttribute("root");
  1184.             var rmtProject=tocNode.getElementsByTagName("project");
  1185.             var aRProj=new Array();
  1186.             if(rmtProject.length>0)
  1187.             {
  1188.                 for(var i=0;i<rmtProject.length;i++)
  1189.                 {
  1190.                     aRProj[i]=new Object();
  1191.                     var sURL=rmtProject[i].getAttribute("url");
  1192.                     if(sURL)
  1193.                     {
  1194.                         if(sURL.lastIndexOf("/")!=sURL.length-1)
  1195.                             sURL+="/";                        
  1196.                     }
  1197.                     aRProj[i].sPPath=sURL;
  1198.                     aRProj[i].sRPath = "";
  1199.                     var oSubPath = rmtProject[i].getElementsByTagName("subpath")[0];
  1200.                     if (oSubPath)
  1201.                     {
  1202.                         while (oSubPath)
  1203.                         {
  1204.                             aRProj[i].sRPath += oSubPath.getAttribute("name") + "\n";
  1205.                             oSubPath = oSubPath.getElementsByTagName("subpath")[0];
  1206.                         }
  1207.                     }
  1208.                     else
  1209.                         aRProj[i].sRPath=rmtProject[i].getAttribute("path");
  1210.                 }
  1211.             }
  1212.             projReady(sRoot,aRProj);
  1213.         }
  1214.     }
  1215.     else
  1216.     {
  1217.         var chunkNode=xmlDoc.getElementsByTagName("tocdata")[0];
  1218.         if(chunkNode)
  1219.         {
  1220.             var aToc=new Array();
  1221.             processBook(chunkNode,aToc);
  1222.             putData(aToc);
  1223.         }
  1224.     }
  1225. }
  1226.  
  1227. function processBook(node,aToc)
  1228. {
  1229.     var i=0;
  1230.     var entry=null;
  1231.     var prevEntry=null;
  1232.     var oChild=node.firstChild;
  1233.     do{
  1234.         if(oChild)
  1235.         {
  1236.             if(oChild.nodeName.indexOf("#")!=0)
  1237.             {
  1238.                 var sName=oChild.getAttribute("name");
  1239.                 var sURL=oChild.getAttribute("url");
  1240.                 var sRef=oChild.getAttribute("ref");
  1241.                 var sTarget=oChild.getAttribute("target");
  1242.                 var sIcons=oChild.getAttribute("images");
  1243.                 var item=new Object();
  1244.                 item.sItemName=sName;
  1245.                 if(sTarget)
  1246.                     item.sTarget=sTarget;
  1247.                 if(sIcons)
  1248.                     item.sIconRef=sIcons;
  1249.                 if(sURL==null) sURL="";
  1250.  
  1251.                 item.sItemURL=sURL;
  1252.                 
  1253.                 if(oChild.nodeName=="book")
  1254.                 {
  1255.                     item.nType=1;
  1256.                     aToc[aToc.length]=item;
  1257.                     var nCurrPos=aToc.length;
  1258.                     processBook(oChild,aToc);
  1259.                     item.nContents=aToc.length-nCurrPos;
  1260.                 }
  1261.                 else if(oChild.nodeName=="item")
  1262.                 {
  1263.                     item.nType=2;
  1264.                     item.nContents=0;
  1265.                     aToc[aToc.length]=item;
  1266.                 }
  1267.                 else if(oChild.nodeName=="remoteitem")
  1268.                 {
  1269.                     item.nType=16;
  1270.                     item.nContents=0;
  1271.                     aToc[aToc.length]=item;
  1272.                 }
  1273.                 else if(oChild.nodeName=="project")
  1274.                 {
  1275.                     if(sRef)
  1276.                     {
  1277.                         if(sRef.lastIndexOf("/")!=sRef.length-1)
  1278.                             sRef+="/";                        
  1279.                     }
  1280.                     item.nType=4;
  1281.                     item.sRefURL=sRef;
  1282.                     item.nContents=0;
  1283.                     aToc[aToc.length]=item;
  1284.                 }
  1285.                 else if(oChild.nodeName=="chunk")
  1286.                 {
  1287.                     item.nType=8;
  1288.                     item.sRefURL=sRef;
  1289.                     item.nContents=0;
  1290.                     aToc[aToc.length]=item;
  1291.                 }
  1292.             }
  1293.         }
  1294.         else
  1295.             break;
  1296.         oChild=oChild.nextSibling;
  1297.     }while(true);
  1298. }
  1299.  
  1300. function putData(aTocs)
  1301. {
  1302.     gaTocsNs61Fix=aTocs;
  1303.     setTimeout("realPutData();",1);
  1304. }
  1305.  
  1306. function realPutData()
  1307. {
  1308.     removeLoadingDiv();
  1309.     var aTocs=gaTocsNs61Fix;
  1310.     if(!aTocs) return;
  1311.     if(goChunk)
  1312.     {
  1313.         var n=gnMinIdx;
  1314.         goChunk.nMI=gnMinIdx;
  1315.         goChunk.aTocs=aTocs;
  1316.         gnMinIdx+=aTocs.length;
  1317.         if(gnInsIdx!=-1)
  1318.         {
  1319.             var oObj=getElement(getPBId(gnInsIdx));
  1320.             if(oObj)
  1321.             {
  1322.                 oObj.insertAdjacentHTML("afterEnd",writeBookItems(n-1,aTocs.length));
  1323.                 setTimeout("syncInit()",1);
  1324.             }
  1325.         }
  1326.         else{
  1327.             document.body.insertAdjacentHTML("beforeEnd",writeBookItems(n-1,aTocs.length));
  1328.             var oParam=new Object();
  1329.             oParam.oTocInfo=null;
  1330.             var oMsg=new whMessage(WH_MSG_GETTOCPATHS,this,1,oParam);
  1331.             if(SendMessage(oMsg))
  1332.             {
  1333.                 if(oMsg.oParam.oTocInfo)
  1334.                     syncWithPaths(oMsg.oParam.oTocInfo);
  1335.             }
  1336.         }    
  1337.     }
  1338.     gbLData=false;
  1339.     checkFillStub();
  1340. }
  1341.  
  1342. function syncWithPaths(oTopicParam)
  1343. {
  1344.     var aPaths=getTocPaths(oTopicParam);
  1345.     if(gsTP)
  1346.         gaBTPs=aPaths;
  1347.     else{
  1348.         var sPath=getClosestTocPath(aPaths);
  1349.         if(sPath!=null)
  1350.         {
  1351.             gsTP=sPath;
  1352.             setTimeout("syncInit()",1);
  1353.         }
  1354.     }
  1355. }
  1356.  
  1357. function window_OnLoad()
  1358. {
  1359.     if(gsBgImage&&gsBgImage.length>0)
  1360.     {
  1361.         document.body.background=gsBgImage;
  1362.     }
  1363.     if(gsBgColor&&gsBgColor.length>0)
  1364.     {
  1365.         document.body.bgColor=gsBgColor;
  1366.     }
  1367.     loadToc();
  1368.     var oMsg=new whMessage(WH_MSG_SHOWTOC,this,1,null)
  1369.     SendMessage(oMsg);
  1370. }
  1371.  
  1372. function loadImages()
  1373. {
  1374.     if(giBookClose)
  1375.     {
  1376.         gaImgs[gnImages]=giBookClose;
  1377.         gnImages++;
  1378.     }        
  1379.     if(giBookOpen)
  1380.     {
  1381.         gaImgs[gnImages]=giBookOpen;
  1382.         gnImages++;
  1383.     }        
  1384.     if(giBookItem)
  1385.     {
  1386.         gaImgs[gnImages]=giBookItem;
  1387.         gnImages++;
  1388.     }        
  1389.     if(giURLItem)
  1390.     {
  1391.         gaImgs[gnImages]=giURLItem;
  1392.         gnImages++;
  1393.     }        
  1394.     if(giNewBookClose)
  1395.     {
  1396.         gaImgs[gnImages]=giNewBookClose;
  1397.         gnImages++;
  1398.     }        
  1399.     if(giNewBookOpen)
  1400.     {
  1401.         gaImgs[gnImages]=giNewBookOpen;
  1402.         gnImages++;
  1403.     }        
  1404.     if(giNewBookItem)
  1405.     {
  1406.         gaImgs[gnImages]=giNewBookItem;
  1407.         gnImages++;
  1408.     }        
  1409.     if(giNewURLItem)
  1410.     {
  1411.         gaImgs[gnImages]=giNewURLItem;
  1412.         gnImages++;
  1413.     }
  1414.     if(gnImages>0)
  1415.     {
  1416.         setTimeout("loadDataAfter();",1000);
  1417.         loadImage(gaImgs[0]);
  1418.     }
  1419.     else
  1420.         loadDataAfter();
  1421. }
  1422.  
  1423. function loadImage(sURL)
  1424. {
  1425.     var oImg=new Image();
  1426.     oImg.onload=checkImageLoading;
  1427.     oImg.onerror=errorImageLoading;
  1428.     oImg.src=_getFullPath(gaProj[0].sPPath,sURL);
  1429. }
  1430.  
  1431. function loadDataAfter()
  1432. {
  1433.     if(!gbLoadData)
  1434.     {
  1435.         gbLoadData=true;
  1436.         loadTData();
  1437.     }
  1438. }
  1439.  
  1440. function errorImageLoading()
  1441. {
  1442.     gnLoadedImages++;
  1443.     if(gnImages==gnLoadedImages)
  1444.         loadDataAfter();
  1445.     else
  1446.         loadImage(gaImgs[gnLoadedImages]);    
  1447. }
  1448.  
  1449. function checkImageLoading()
  1450. {
  1451.     gnLoadedImages++;
  1452.     if(gnImages==gnLoadedImages)
  1453.         loadDataAfter();
  1454.     else
  1455.         loadImage(gaImgs[gnLoadedImages]);    
  1456. }
  1457.  
  1458. function window_unload()
  1459. {
  1460.     UnRegisterListener2(this,WH_MSG_PROJECTREADY);
  1461.     UnRegisterListener2(this,WH_MSG_SYNCTOC);
  1462.     UnRegisterListener2(this,WH_MSG_SHOWTOC);
  1463. }
  1464.  
  1465. function onSendMessage(oMsg)
  1466. {
  1467.     if(oMsg)
  1468.     {
  1469.         var nMsgId=oMsg.nMessageId;
  1470.         if(nMsgId==WH_MSG_PROJECTREADY)
  1471.         {
  1472.             loadToc();
  1473.         }
  1474.         else if(nMsgId==WH_MSG_SYNCTOC)
  1475.         {
  1476.             if(gbReady)
  1477.             {
  1478.                 syncWithPaths(oMsg.oParam);
  1479.             }
  1480.         }
  1481.         else if(nMsgId==WH_MSG_SHOWTOC)
  1482.         {
  1483.             if(!gbNav6)
  1484.                 document.body.focus();
  1485.         }
  1486.     }
  1487.     return true;
  1488. }
  1489.  
  1490. if(window.gbWhUtil&&window.gbWhVer&&window.gbWhMsg&&window.gbWhProxy)
  1491. {
  1492.     RegisterListener2(this,WH_MSG_PROJECTREADY);
  1493.     RegisterListener2(this,WH_MSG_SYNCTOC);
  1494.     RegisterListener2(this,WH_MSG_SHOWTOC);
  1495.     goFont=new whFont("Verdana","8pt","#000000","normal","normal","none");
  1496.     goHFont=new whFont("Verdana","8pt","#007f00","normal","normal","underline");
  1497.  
  1498.     window.onload=window_OnLoad;
  1499.     window.onbeforeunload=window_BUnload;
  1500.     window.onunload=window_unload;
  1501.     gbWhTHost=true;
  1502. }
  1503. else
  1504.     document.location.reload();